package jym.tan.tmdb.method.get;

import java.net.URL;

import jym.tan.tmdb.TMDB;
import jym.tan.tmdb.bean.wrapper.PersonImageWrapper;
import jym.tan.tmdb.constant.TMDBConstants;
import jym.tan.tmdb.method.Base;

/**
 * The Class PersonImages. This class is similar to the <b>Person Images</b> method described in 
 * <a href="http://help.themoviedb.org/kb/api/person-credits">Person Images</a>.
 * This method is used to retrieve all of the profile images for a person.
 * @author Tanmoy
 */
public class PersonImages extends Base {

	/**
	 * Instantiates a new PersonImages.
	 *
	 * @param tmdb 
	 * 		An instance of the {@link TMDB} class
	 */
	public PersonImages(TMDB tmdb) {
		super(tmdb, TMDBConstants.PERSON, TMDBConstants.IMAGES);
	}

	/**
	 * Gets a {@link PersonImageWrapper} object.
	 *
	 * @param personId 
	 * 		The Person id
	 * @return 
	 * 		The <code>PersonImageWrapper</code> object
	 * @throws Exception 
	 * 		If any kind off exception occurred
	 */
	public PersonImageWrapper getPersonImageWrapper(int personId) throws Exception {
		URL personImageURL = getUrl(String.valueOf(personId));
		PersonImageWrapper personImageWrapper = getJsonObject(personImageURL, PersonImageWrapper.class);
		return personImageWrapper;	
	}
}
